export const schema = {
    type: "page",
    title: "认领列表",
    toolbar: {
        type: 'button',
        actionType: 'link',
        link: '/claim_project/create?org_id=${org_id}',
        label: '创建项目',
        level: 'info'
    },
    body: {
        type: "crud",
        api: "/api/claim_project",
        filter: {
            title: "",
            panelClassName: 'm-b-none bg-gd no-border',
            bodyClassName: 'wrapper-sm',
            submitText: "",
            controls: [
                {
                    type: "text",
                    name: "keywords",
                    label: "项目查询",
                    placeholder: "项目名称"
                },

                {
                    type: "submit",
                    label: "搜索",
                    primary: true
                },

                {
                    type: "button",
                    label: "导出",
                    level: "info",
                    actionType: "url",
                    url: "/api/claim_project?asExcel=1&keyword=${keyword}"
                }
            ]
        },
        columnsTogglable: false,
        bulkActions: [
            {
                type: "button",
                label: "导出选定",
                level: "info",
                actionType: "url",
                url: "/api/claim_project?asExcel=1&ids=${ids}"
            }
        ],
        columns: [
            {
                name: "name",
                label: "项目名称"
            },
            {
                label: "项目发起日期",
                name: "created_at",
                type: 'tpl',
                tpl: "${created_at|date:LL:YYYY-MM-DD HH:mm:ss}"
            },
            {
                label: "认领截止日期",
                name: "end",
                type: 'date'
            },
            {
                label: "认领人数",
                name: 'apply_count'
            },
            {
                label: "操作",
                type: "operation",
                width: 180,
                buttons: [
                    {
                        type: "button",
                        size: "xs",
                        label: "认领查看",
                        actionType: 'link',
                        link: '/claim_project/${id}/apply'
                    },
                    {
                        type: "button",
                        size: "xs",
                        level: "info",
                        label: "编辑",
                        actionType: "link",
                        link: "/claim_project/edit/${id}"
                    },

                    {
                        type: "button",
                        size: "xs",
                        level: "danger",
                        label: "下架",
                        actionType: 'ajax',
                        visibleOn: 'data.status == 1',
                        api: '/api/claim_project/offline/${id}'
                    },
                    {
                        type: "button",
                        size: "xs",
                        level: "success",
                        label: "上架",
                        visibleOn: 'data.status == 0',
                        actionType: 'ajax',
                        api: '/api/claim_project/online/${id}'
                    },
                    {
                        type: "button",
                        size: "xs",
                        level: "danger",
                        label: "删除",
                        confirmText: '确定要删除？',
                        actionType: 'ajax',
                        api: 'delete:/api/claim_project/${id}'
                    },
                ]
            }
        ]
    }
};
